#coding=utf-8
#测试报告生成
#创建者：陈强
#创建日期：2019/04/3

from HTMLTestRunner import HTMLTestRunner
import os
import datetime,time

class report():
    def __init__(self):
        self.filepath = 'D:\\python-photo\\html\\'
    def write_report(self,filename,test):
        # 定义输出报告路径
        now = time.strftime("%Y-%m-%M-%H_%M_%S", time.localtime(time.time()))
        htmlfile = self.filepath + now + filename + '.html'
        print htmlfile
        with open(htmlfile, "wb") as file:
            runner = HTMLTestRunner(stream=file, verbosity=2, title="朵云社区接口测试报告",
                                    description="当日测试回归报告，请各位知晓！包括平台、文章类接口")
            runner.run(test)

